package com.yyj.qy163springboot.service.impl;

import com.yyj.qy163springboot.mapper.StudentMapper;
import com.yyj.qy163springboot.pojo.Student;
import com.yyj.qy163springboot.service.Studentservice;
import com.yyj.qy163springboot.util.Result;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

import java.util.List;

/**
 * @program: qy163sringboot
 * @description:
 * @author: 杨英俊
 * @create: 2023-04-10 19:31
 **/
@Service
public class StudentserviceImpl implements Studentservice {
    @Autowired
    private StudentMapper studentMapper;
    @Override
    public Result queryAll() {
        List<Student> all = studentMapper.findAll();
        return new Result(200,"查询成功",all);
    }

    @Override
    public Result save(Student student) {
        Integer save = studentMapper.save(student);
        return new Result(200,"添加成功",save);
    }

    @Override
    public Result delete(Integer id) {
        Integer delete = studentMapper.delete(id);
        return new Result(200,"删除成功",delete);
    }

    @Override
    public Result update(Student student) {
        Integer update = studentMapper.update(student);
        return new Result(200,"修改成功",update);
    }
}
